{extend name="common@create" /}
{block name="formaa"}
	<form action="/chengji/{$list.id}" method="PUT" class="form form-horizontal" id="form-member-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">考试名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				{$list['cj_kaoshi']['title']}
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>学生姓名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				{$list['cj_student']['xingming']}
			</div>
		</div>
		{php}
			
			$xk = new \app\teach\model\Subject;
			$xk = $xk->where('id','<',4)->select();
			$xkTitle = $xk->column('title','id');
			$xkLieming = $xk->column('lieming','id');

			$cj = new \app\chengji\model\Chengji;
			$cj = $cj->where('id',$list['id'])->append(['cj_manfen'])->find();
	        foreach ($cj->cj_manfen as $key => $value) {
	            $manfen[$value['subjectid']]=$value['manfen'];
	        }
		{/php}
		{foreach $manfen as $key=>$vo}
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">{$xkTitle[$key]}：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$list[$xkLieming[$key]]}" placeholder="由汉字或字母组成" id="{$xkLieming[$key]}" name="{$xkLieming[$key]}">
			</div>
		</div>
		{/foreach}
		
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
{/block}
{block name="yanzheng"}
<script type="text/javascript">

	// 匹配用户名
	$.validator.addMethod("zh",function(value,element){
		var tel = /^[\u4e00-\u9fa5]*$/;
		return this.optional(element) || tel.test(value);
	}, "请输入中文");

	// // 只能输入.5成绩
	$.validator.addMethod("cj",function(value){
		var tel = (value*10)%5;
		if(tel == ''){
			return true;
		}else{
			return false;
		}
	}, "不要输入.5以外成绩。");

	
	// 设置表单验证规则
	var myrules = {			
			yuwen:{
				number:true,
				min:0,
				max:{$manfen[1]},
				cj:true
			},
			shuxue:{
				number:true,
				min:0,
				max:{$manfen[2] ? $manfen[2] : 0},
				cj:true
			},
			waiyu:{
				number:true,
				min:0,
				max:{$manfen[3] ? $manfen[3] : 0},
				cj:true
			},
		};

	// 设置表单提交方式
	var mytype = 'PUT';
</script>
{/block}